<% shipment.manifest.each do |item| %>
  <tr class="stock-item" data-item-quantity="<%= item.quantity %>">
    <td class="item-image image text-center">
      <%= mini_image(item.variant) %>
    </td>

    <td class="item-name">
      <%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
      <% if item.variant.sku.present? %>
        <strong><%= Spree.t(:sku) %>:</strong> <%= item.variant.sku %>
      <% end %>
    </td>

    <td class="item-price text-center"><%= item.line_item.single_money.to_html %></td>

    <td class="item-qty-show text-center">
      <% item.states.each do |state,count| %>
        <%= count %> x <%= Spree.t(state).downcase %>
      <% end %>
    </td>

    <% unless shipment.shipped? %>
      <td class="item-qty-edit is-hidden">
        <%= number_field_tag :quantity, item.quantity, min: 0, class: "line_item_quantity form-control", size: 5 %>
      </td>
    <% end %>

    <td class="item-total text-center">
      <%= line_item_shipment_price(item.line_item, item.quantity) %>
    </td>

    <td class="cart-item-delete actions actions-3 text-center" data-hook="cart_item_delete">
      <% if((!shipment.shipped?) && can?(:update, item.line_item)) %>
        <%= link_to_with_icon 'pencil', Spree.t('actions.edit'), "#", class: 'edit-item btn btn-default btn-sm', title: Spree.t('actions.edit'), no_text: true %>
        <%= link_to_with_icon 'cancel', Spree.t('actions.cancel'), "#", class: 'cancel-item  btn btn-primary btn-sm', data: { action: 'cancel' }, title: Spree.t('actions.cancel'), style: 'display: none', no_text: true %>
        <%= link_to_with_icon 'ok', Spree.t('actions.save'), "#", class: 'save-item btn btn-success btn-sm', data: {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, action: 'save'}, title: Spree.t('actions.save'), style: 'display: none', no_text: true %>
        <%= link_to_with_icon 'split', Spree.t('split'), "#", class: 'split-item btn btn-primary btn-sm', data: {action: 'split', 'variant-id' => item.variant.id}, title: Spree.t('split'), no_text: true %>
        <%= link_to_with_icon 'delete', Spree.t('delete'), "#", class: 'delete-item btn btn-danger btn-sm', data: { 'shipment-number' => shipment.number, 'variant-id' => item.variant.id, action: 'remove'}, title: Spree.t('delete'), no_text: true %>
      <% end %>
    </td>
  </tr>
<% end %>
